﻿namespace OF.Utility.AlipayWap
{
    /// <summary>
    /// 类名：Config
    /// 功能：基础配置类
    /// 详细：设置帐户有关信息及返回路径
    /// 版本：3.3
    /// 日期：2012-07-05
    /// 说明：
    /// 以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
    /// 该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
    /// 
    /// 如何获取安全校验码和合作身份者ID
    /// 1.用您的签约支付宝账号登录支付宝网站(www.alipay.com)
    /// 2.点击“商家服务”(https://b.alipay.com/order/myOrder.htm)
    /// 3.点击“查询合作者身份(PID)”、“查询安全校验码(Key)”
    /// </summary>
    public class Config
    {
        #region 字段
        private static string partner = "";
        private static string key = "";
        private static string private_key = "";
        private static string public_key = "";
        private static string input_charset = "";
        private static string sign_type = "";
        #endregion

        static Config()
        {
            //↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

            //合作身份者ID，以2088开头由16位纯数字组成的字符串
            partner = System.Configuration.ConfigurationManager.AppSettings["alipay_partner"];

            //交易安全检验码，由数字和字母组成的32位字符串
            //如果签名方式设置为“MD5”时，请设置该参数
            key = System.Configuration.ConfigurationManager.AppSettings["alipay_key"];

            //商户的私钥
            private_key = @"MIIEpQIBAAKCAQEAombvZBmBiodrRM1GzIzLqZHmxsHZzGKolQzQPUs1v7/zAM1nTQqOc7dFQ0BdM4t5VguZrw40E6WxpNhjQLqOBY7RCRgZLWHVAEWoHs4hMH3oATkb3+oyk9+wD2UsszfGifnPnJVF3evRbK3AGesw2Z/QUHc+ZnP457IBBf0pydVurB1Y4Th5wAJckKWGZqlaqhSCPz8z5IdRwRYlG9TeHdygTbybljKtAkjmbDOlD1XQhLmTwngrisI4JAM3Ei13tawLNk2HrY/sayW2GXbZGtgumlhTJ5W1rptEbQtvxYOTyxtfldX2Ly1pYBi1tQs3VDY8ftyt1tKeUyX5ctKmLQIDAQABAoIBACEs/gJo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NAlaaB/Kb0eTFT8BPN+mZvxSjR1/QAAlDyLP9lxXkcJUW9bSlvI8nJ+xAZviCBAX4psBMncZMrmbFCV+uW8SJhj3cIAoxs8hiW7LIGCYhJTbJUusyeNvOQ25gjBaeReGM=";

            //支付宝应用公钥
            public_key = @"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAszlq1rK+6KhH5LsuZO42aSA6vvPJS0VVuf+GmB7QAq28mDPzsu1pXGJFBNuizaWs1aJmUVw3JQMc/ICPw4XxR500g9tbFWP8VPa5H8rcIJ0M54vfUXReycscjZnY44SoovaK9yv3fTIiQF5xXWplvg4yo4dCLZPFieZs8WFEG9iYbmyUQ0sn+dMv3UcLeClrf+jMEtAoxTOXZmnEkxyAPap7YgcSH4EkSjyNqjz//+pX077e11EP+WwG7YuXMEmBU31bpu6dHpus6/kxowGSNLQ7fCoMU8cYeOoBIPtE0qqvIiNoTAT3WuLna3W/aPzxodstUccnVnbK2uuWjrEZlQIDAQAB";
            //↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

            //字符编码格式 目前支持 utf-8
            input_charset = "utf-8";

            //签名方式，选择项：0001(RSA)、MD5
            //sign_type = "0001";
            sign_type = "RSA2";
            //无线的产品中，签名方式为rsa时，sign_type需赋值为0001而不是RSA
        }

        #region 属性
        /// <summary>
        /// 应用公钥
        /// </summary>
        public static string AppPublicKey
        {
            get
            {
                return
                    "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAombvZBmBiodrRM1GzIzLqZHmxsHZzGKolQzQPUs1v7/zAM1nTQqOc7dFQ0BdM4t5VguZrw40E6WxpNhjQLqOBY7RCRgZLWHVAEWoHs4hMH3oATkb3+oyk9+wD2UsszfGifnPnJVF3evRbK3AGesw2Z/QUHc+ZnP457IBBf0pydVurB1Y4Th5wAJckKWGZqlaqhSCPz8z5IdRwRYlG9TeHdygTbybljKtAkjmbDOlD1XQhLmTwngrisI4JAM3Ei13tawLNk2HrY/sayW2GXbZGtgumlhTJ5W1rptEbQtvxYOTyxtfldX2Ly1pYBi1tQs3VDY8ftyt1tKeUyX5ctKmLQIDAQAB";
            }
        }
        /// <summary>
        /// 支付宝公钥,保存支付宝公钥内容，在代码中验签使用
        /// </summary>
        public static string AliPayPublicKey
        {
            get
            {
                return
                    "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAszlq1rK+6KhH5LsuZO42aSA6vvPJS0VVuf+GmB7QAq28mDPzsu1pXGJFBNuizaWs1aJmUVw3JQMc/ICPw4XxR500g9tbFWP8VPa5H8rcIJ0M54vfUXReycscjZnY44SoovaK9yv3fTIiQF5xXWplvg4yo4dCLZPFieZs8WFEG9iYbmyUQ0sn+dMv3UcLeClrf+jMEtAoxTOXZmnEkxyAPap7YgcSH4EkSjyNqjz//+pX077e11EP+WwG7YuXMEmBU31bpu6dHpus6/kxowGSNLQ7fCoMU8cYeOoBIPtE0qqvIiNoTAT3WuLna3W/aPzxodstUccnVnbK2uuWjrEZlQIDAQAB";
            }
        }
        /// <summary>
        /// 获取或设置合作者身份ID
        /// </summary>
        public static string Partner
        {
            get { return partner; }
            set { partner = value; }
        }
        /// <summary>
        /// AppID 
        /// </summary>
        public static string AppID=> System.Configuration.ConfigurationManager.AppSettings["alipay_AppId"];
        /// <summary>
        /// 是否在调试模式，是的话，支付金额始终为0.01
        /// </summary>
        public static bool IsInTestMode
        {
            get
            {
                return System.Configuration.ConfigurationManager.AppSettings["IsInTestMode"]=="true";
            }
        }

        /// <summary>
        /// 获取或设交易安全校验码
        /// </summary>
        public static string Key
        {
            get { return key; }
            set { key = value; }
        }

        /// <summary>
        /// 获取或设置商户的私钥
        /// </summary>
        public static string Private_key
        {
            get { return private_key; }
            set { private_key = value; }
        }

        /// <summary>
        /// 获取或设置支付宝的公钥
        /// </summary>
        public static string Public_key
        {
            get { return public_key; }
            set { public_key = value; }
        }

        /// <summary>
        /// 获取字符编码格式
        /// </summary>
        public static string Input_charset
        {
            get { return input_charset; }
        }

        /// <summary>
        /// 获取签名方式
        /// </summary>
        public static string Sign_type
        {
            get { return sign_type; }
        }
        #endregion
        /// <summary>
        /// 同步回调地址
        /// </summary>
        public static string ReturnUrl => System.Configuration.ConfigurationManager.AppSettings["alipay_return"];
        /// <summary>
        /// 异步回调地址
        /// </summary>
        public static string NotifyUrl => System.Configuration.ConfigurationManager.AppSettings["alipay_notify"];
    }
}